/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.pub.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.core.model.Attach;
import com.tech15.pub.model.*;
import com.tech15.pub.dao.*;
import com.tech15.pub.service.*;
import com.tech15.pub.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "PUB_TEMPLATE")
public class PubTemplate extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "办公模版";
	public static final String ALIAS_ID = "id";
	public static final String ALIAS_NAME = "名称标题";
	public static final String ALIAS_ZT = "主题";
	public static final String ALIAS_LB = "类别";
	public static final String ALIAS_MEMO = "备注";
	public static final String ALIAS_UPTIME = "时间";
	
	//date formats
	public static final String FORMAT_UPTIME = DATE_TIME_FORMAT;
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * id       db_column: ID 
     */ 	
	@Length(max=32)
	private java.lang.String id;
    /**
     * 名称标题       db_column: NAME 
     */ 	
	@Length(max=200)
	private java.lang.String name;
    /**
     * 主题       db_column: ZT 
     */ 	
	
	private Long zt;
    /**
     * 类别       db_column: LB 
     */ 	
	
	private Long lb;
    /**
     * 备注       db_column: MEMO 
     */ 	
	@Length(max=600)
	private java.lang.String memo;
    /**
     * 时间       db_column: UPTIME 
     */ 	
	
	private java.util.Date uptime;
	//columns END


	public PubTemplate(){
	}

	public PubTemplate(
		java.lang.String id
	){
		this.id = id;
	}

	

	public void setId(java.lang.String value) {
		this.id = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "uuid.hex")
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 32)
	public java.lang.String getId() {
		return this.id;
	}
	
	@Column(name = "NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getName() {
		return this.name;
	}
	
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	@Column(name = "ZT", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getZt() {
		return this.zt;
	}
	
	public void setZt(Long value) {
		this.zt = value;
	}
	
	@Column(name = "LB", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getLb() {
		return this.lb;
	}
	
	public void setLb(Long value) {
		this.lb = value;
	}
	
	@Column(name = "MEMO", unique = false, nullable = true, insertable = true, updatable = true, length = 600)
	public java.lang.String getMemo() {
		return this.memo;
	}
	
	public void setMemo(java.lang.String value) {
		this.memo = value;
	}
	
	@Transient
	public String getUptimeString() {
		return DateConvertUtils.format(getUptime(), FORMAT_UPTIME);
	}
	public void setUptimeString(String value) {
		setUptime(DateConvertUtils.parse(value, FORMAT_UPTIME,java.util.Date.class));
	}
	
	@Column(name = "UPTIME", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getUptime() {
		return this.uptime;
	}
	
	public void setUptime(java.util.Date value) {
		this.uptime = value;
	}
	
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Name",getName())
			.append("Zt",getZt())
			.append("Lb",getLb())
			.append("Memo",getMemo())
			.append("Uptime",getUptime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof PubTemplate == false) return false;
		if(this == obj) return true;
		PubTemplate other = (PubTemplate)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
	private List<Attach> attach;
	private String dataname;
	private Long userid;

	@Transient
	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}

	@Transient
	public List<Attach> getAttach() {
		return attach;
	}

	public void setAttach(List<Attach> attach) {
		this.attach = attach;
	}

	@Transient
	public String getDataname() {
		return dataname;
	}

	public void setDataname(String dataname) {
		this.dataname = dataname;
	}
}

